X-Git-Url: https://git.r.bdr.sh/rbdr/super-polarity/blobdiff_plain/38c7d3f9eb7d63937c6654ff5dd6046ce02dd59c..74c155708d85abfc2cf227c08de4f27003015b3f:/Super%20Polarity/Actors/StandardShip.cs diff --git a/Super Polarity/Actors/StandardShip.cs b/Super Polarity/Actors/StandardShip.cs index 50a671a..556be0f 100644 --- a/Super Polarity/Actors/StandardShip.cs +++ b/Super Polarity/Actors/StandardShip.cs @@ -20,7 +20,7 @@ namespace SuperPolarity protected Random Random; protected bool AddingAngle; - public StandardShip(Game newGame) : base(newGame) {} + public StandardShip(SuperPolarity newGame) : base(newGame) {} public override void Initialize(Texture2D texture, Vector2 position) { @@ -37,6 +37,8 @@ namespace SuperPolarity RotationFactor = (float) (3 * Math.PI / 180); Random = new Random(BitConverter.ToInt32(cryptoResult, 0)); AddingAngle = true; + + HP = 5; } public override void Magnetize(Ship ship, float distance, float angle) @@ -56,6 +58,7 @@ namespace SuperPolarity } ChangeAngle(); Position += Velocity; + UpdateBox(); Magnetizing = false; } @@ -110,5 +113,33 @@ namespace SuperPolarity Velocity.Y = -Velocity.Y; } } + + public override void Collide(Actor other, Rectangle collision) + { + if (Dying) + { + return; + } + + if (other.GetType() == typeof(MainShip)) + { + Die(); + return; + } + + if (other.GetType() == typeof(Bullet)) + { + var theBullet = (Bullet)other; + TakeDamage(theBullet.Power); + } + } + + protected override void Die() + { + ActorManager.CheckOut(this); + Renderer.CheckOut(this); + game.Player.AddScore(Value); + game.Player.AddMultiplier(1); + } } }